import request from '@/utils/request.js'

//将针对Admin的所有请求封装到一个对象里面
const productApi = {
	list(productQuery) {
		return request.get('/product/list',{params: productQuery})
	},
	deleteById(id) {
		return request.delete( `/product/deleteById/${id}`)   //反引号，直接写参数。否则需要字符串拼接
	},
	deleteAll(ids) {
		return request.delete( `/product/deleteAll/${ids}`)
	},
	add(product) {
		//blog以JSON形式传递到后台
		return request.post('/product/add', product)
	},
	selectById(id) {
		return request.get(`/product/selectById/${id}`)
	},
	update(product) {
		return request.put('/product/update', product)
	},
	updateStatus(id,status){
		return request.put(`/product/updateStatus/${id}/${status}`)
	},
	
}

export default productApi